package com.umpay.privi.common;

import java.sql.SQLException;
import com.ibatis.sqlmap.client.extensions.ParameterSetter;
import com.ibatis.sqlmap.client.extensions.ResultGetter;
import com.ibatis.sqlmap.client.extensions.TypeHandlerCallback;
/**
 * 
 * desc:
 * <p>创建人：liuguangjun 创建日期：Nov 27, 2012 </p>
 * @version V1.0
 */
public class TrimTypeHandlerCallback implements TypeHandlerCallback{
//	private static final Logger logger = SpEnLogManager.getDetail(); 
	
	/**
	 * 对结果去空格
	 */
	public Object getResult(ResultGetter paramResultGetter) throws SQLException {
		try{
			String result="";
			if(paramResultGetter.getString()!=null){
				result=paramResultGetter.getString().trim();
			}
			return result;
		}catch(SQLException ex){
//			logger.error("getResult:"+ex);
			throw ex;
		}
	}
	/**
	 * 对输入参数去空格
	 */
	public void setParameter(ParameterSetter paramParameterSetter,
			Object paramObject) throws SQLException {
		try{
			paramParameterSetter.setString(paramObject.toString().trim());
		}catch(SQLException ex){
//			logger.error("setParameter:"+ex);
			throw ex;
		}
		
	}

	public Object valueOf(String paramString) {
		return null;
	}

}
